package com.budwk.app.util.poiUtils.fireHiddenExcel.impl;

import cn.hutool.core.bean.BeanUtil;
import com.budwk.app.sqfw.dto.FireHiddenExcelParamSQDTO;
import com.budwk.app.sqfw.dto.FireHiddenExcelParamWeiQingMenSQDTO;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.util.poiUtils.WeiQingMenStreetFireHiddenExcelUtils;
import com.budwk.app.util.poiUtils.fireHiddenExcel.IFireHiddenExcel;

import java.util.ArrayList;

/**
 * @author ywm
 * @project wk-mini
 * @description 威清门
 * @date 2023/11/29 16:51:18
 */
public class WeiQingMenFireHiddenExcel implements IFireHiddenExcel {

    @Override
    public String createExcel(FireHiddenExcelParamSQDTO excelParamSQDTO, String tm) {
        return null;
    }

    @Override
    public String createExcel(FireHiddenExcelParamSQDTO excelParamSQDTO) {
        Sys_user createFileUser = sysUserService.fetch(excelParamSQDTO.getUserId());
        FireHiddenExcelParamWeiQingMenSQDTO dto = new FireHiddenExcelParamWeiQingMenSQDTO();
        BeanUtil.copyProperties(excelParamSQDTO, dto);
        dto.setCreateUserName(createFileUser.getUsername());
        dto.setCreateUserPhone(createFileUser.getLoginname());
        dto.setProvince(createFileUser.getProvince());
        dto.setCity(createFileUser.getCity());
        dto.setDistrict(createFileUser.getDistrict());
        dto.setCounty(createFileUser.getCounty());
        dto.setCommunity(createFileUser.getCommunity());
        dto.setIsTemplate(false);
        return WeiQingMenStreetFireHiddenExcelUtils.createFireHiddenExcelSQ(dto,null);
    }

    @Override
    public String downExcelTemplate(FireHiddenExcelParamSQDTO excelParamSQDTO) {
        Sys_user createFileUser = sysUserService.fetch(excelParamSQDTO.getUserId());
        FireHiddenExcelParamWeiQingMenSQDTO dto = new FireHiddenExcelParamWeiQingMenSQDTO();
        BeanUtil.copyProperties(excelParamSQDTO, dto);
        dto.setCreateUserName(createFileUser.getUsername());
        dto.setCreateUserPhone(createFileUser.getLoginname());
        dto.setProvince(createFileUser.getProvince());
        dto.setCity(createFileUser.getCity());
        dto.setDistrict(createFileUser.getDistrict());
        dto.setCounty(createFileUser.getCounty());
        dto.setCommunity(createFileUser.getCommunity());
        dto.setFormSummaryList(new ArrayList<>());
        dto.setIsTemplate(true);
        return WeiQingMenStreetFireHiddenExcelUtils.createFireHiddenExcelSQ(dto,null);
    }
}
